package com.hs.shirodemo01.utils;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @ClassName Result
 * @Description 结果集
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result {
    private Integer code;
    private String msg;
    private Object data;

    public static Result success(){
        return new Result(Constant.SUCCESS.getCode(),Constant.SUCCESS.getMsg(),null);
    }

    public static Result success(Object data){
        return new Result(Constant.SUCCESS.getCode(),Constant.SUCCESS.getMsg(), data);
    }

    public static Result success(String msg,Integer code){
        return new Result(code,msg,null);
    }

    public static Result error(){
        return new Result(Constant.ERR.getCode(),Constant.ERR.getMsg(),null);
    }
}
